<!DOCTYPE html>
<html>
<head>
    <title></title>
		<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <div style="float: left;height:34px;line-height:34px;">优惠券名称：</div>
            <div style="float: left;">
                <input type="text" class="form-control" v-model="q.name" @keyup.enter="query" placeholder="请输入内容">
            </div>
            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">创建时间：</div>
            <div style="float: left;width:350px;margin-right: 10px;" id="sandbox-container">

                <div class="input-group date" style="width:46%;float:left;">
                    <input type="text" class="form-control" id="startime"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                </div>
                <div style="width: 4%;float:left;margin-left:7px;margin-top:8px;padding-left:1px;">
                    -
                </div>
                <div class="input-group date" style="width:48%;">
                    <input type="text" class="form-control" id="endtime"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                </div>

            </div>
            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">状态：</div>
            <div style="float: left;width:160px;margin-right: 10px;">
                <select class="form-control" v-model="q.statu" @keyup.enter="query">
                    <option></option>
                    <option value="0">进行中</option>
                    <option value="1">已结束</option>
                    <option value="2">已停用</option>
                </select>
            </div>
            <a class="btn btn-primary" @click="query">查询</a>
			<#if shiro.hasPermission("sys:coupon:save")>
            <a class="btn btn-primary" @click="add">&nbsp;新增优惠券</a>
			</#if>

        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
														                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>优惠卷名称</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="coupon.name" placeholder="优惠卷名称" id="yhjmc" style="float: left"/>
                            <span style="position: absolute;color: rgb(153, 153, 153) !important; padding-left: 10px !important; margin-top:8px;width:350px;">建议描述优惠券提供的具体优惠。例如:满100元减5元</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>面额</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="coupon.denomination" placeholder="面额" id="me"/>
                            <span style="position: absolute;right: 22px;top: 8px;color: #4C4948;line-height: 1.5;">元</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>使用门槛</div>
                        <div class="col-sm-10" style="float: left" >
                            <label class="radio-inline" style="float: left">
                                <input type="radio" name="conditions"  value="0" checked="checked" id="wmk" @click="getConditions"/> 无门槛
                            </label>
                            <label class="radio-inline" style="float: left">
                                <input type="radio" name="conditions"  value="1" id="mj" @click="getConditions"/> 订单满
                            </label>
                            <div style="width:100px;float: left">
                                <input type="text" class="form-control" v-model="coupon.conditions" id="tj">
                                <span style="position: absolute;right: 155px;top: 8px;color: #4C4948;line-height: 1.5;">元</span>
                                <span style="position: absolute;top:8px;right:115px;">可用</span>

                             </div>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>发放总量</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="coupon.count" placeholder="发放数量" id="ffsl"/>
                            <span style="position: absolute;right: 22px;top: 8px;color: #4C4948;line-height: 1.5;">张</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>有效期</div>
                        <div class="col-sm-10" >
                            <label class="radio-inline" style="margin-bottom:5px;">
                                <input type="radio" name="effectivedays" value="0" checked="checked" id="gdrq" @click="getEffective"/> 固定日期
                                <div style="float: left;width:350px;margin-right: 10px;" id="container">

                                    <div class="input-group date" style="width:46%;float:left;">
                                        <input type="text" class="form-control" id="kssj"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                                    </div>
                                    <div style="width: 4%;float:left;margin-left:7px;margin-top:8px;padding-left:1px;">
                                        -
                                    </div>
                                    <div class="input-group date" style="width:48%;">
                                        <input type="text" class="form-control" id="jssj"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                                    </div>

                                </div>
                            </label>
                            <label class="radio-inline" style="float:left;margin: 0px">
                                <input type="radio" name="effectivedays" value="1" id="lqdr" @click="getEffective"/> 领券当日
                            </label>
                            <div style="width: 100px;float:left;margin-left:5px;">
                                <input type="text" class="form-control" v-model="coupon.effectivedays" id="yxq">
                                <span style="position: absolute;top: 75px; right: 135px;">天内有效</span>

                            </div>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>每人限领</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="coupon.limitcount" placeholder="每人限领数量" id="mrxlsl"/>
                            <span style="position: absolute;right: 22px;top: 8px;color: #4C4948;line-height: 1.5;">张</span>
                        </div>
                    </div>
											                    <div class="form-group">
                        <div class="col-sm-2 control-label">
                            共<span id="shelvescount">0</span>个货架
                        </div>
                        <div class="col-sm-10">
                            <a class="btn btn-primary" @click="addShelves" style="background-color: #f07065!important;color:#fff;border: none">&nbsp;添加货架</a>
                        </div>
                    </div>
                    <div class="form-group" style="width:1100px;">
                        <div class="col-sm-2 control-label" style="width:132px;">

                        </div>
                        <div class="col-sm-10" style="width:950px;">
                            <div style="border: none!important;margin: 0!important;width: 100%;">
                                <div style="margin-bottom: 0;min-height: .01%;margin-top: 15px;">
                                    <table style="border-top-left-radius: 3px;border-top-right-radius: 3px;
                            border: 1px solid rgb(226, 229, 237) !important;display: table;margin-bottom: 0!important;width: 100%;border-collapse: collapse;">
                                        <thead style="background-color: #F7F9FB;">
                                        <th style="border-right:solid 1px rgb(226, 229, 237);padding: 10px 0;
                                        font-weight: 400!important;font-size: 12px!important;line-height: 1.42857143;text-align: center;">货架名称</th>
                                        <th style="border-right:solid 1px rgb(226, 229, 237);padding: 10px 0;
                                        font-weight: 400!important;font-size: 12px!important;line-height: 1.42857143;text-align: center;">货架地址</th>
                                        <th style="border-top: 0;border-bottom: 0;border-left: 0;padding: 10px 0;
                                        font-weight: 400!important;font-size: 12px!important;line-height: 1.42857143;text-align: center;">操作</th>
                                        </thead>
                                        <tbody id="shelves">

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

											                    <div class="form-group">
                        <div class="col-sm-2 control-label"><span style="color: red">*</span>发放方式</div>
                        <div class="col-sm-10">
                            <label class="radio-inline" style="float: left">
                                <input type="radio" name="type"  value="0" v-model="coupon.type"/> 自领
                            </label>
                            <label class="radio-inline" style="float: left">
                                <input type="radio" name="type"  value="1" v-model="coupon.type"/> 进店自动发放
                            </label>
                        </div>
                    </div>

							            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <form class="form-horizontal">
                <div class="modal-content" style="width: 650px;">
                    <div style="padding: 15px;">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <div style="padding: 20px 0;border-bottom: 1px solid #E2E5ED;">
                            <p style="font-size: 14px;color: #4c4948;float: left;margin: 0!important;">选择货架</p>
                        </div>
                    </div>
                    <div class="modal-body">
                        <div style="margin-bottom: 15px">
                            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">货架名称：</div>
                            <div style="float: left;width:160px;margin-right: 10px;">
                                <input type="text" class="form-control" v-model="q.sname" @keyup.enter="query" placeholder="请输入内容">
                            </div>
                            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">货架分组：</div>
                            <div style="float: left;width:160px;margin-right: 10px;">
                                <select class="form-control" v-model="q.sheelvesid" @keyup.enter="query" id="s_id">

                                </select>
                            </div>
                            <a class="btn btn-primary" @click="query">搜索</a>
                        </div>

                        <table id="jqGridAdd" style="width: 100%;"></table>
                        <div id="jqGridPagerAdd" style="width: 100%"></div>
                        <a class="btn btn-primary" @click="showShelves" style="margin-left: 290px;margin-top: 10px">确定</a>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <div class="modal fade" id="myCouponDetailModal" tabindex="-1" role="dialog" aria-labelledby="myCouponModalLabel">
        <div class="modal-dialog" role="document" style="margin-left: 100px;">
            <form class="form-horizontal">
                <div class="modal-content" style="width: 1250px;">
                    <input id="couponid" type="hidden">
                    <div style="padding: 15px;">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <div style="padding: 20px 0;border-bottom: 1px solid #E2E5ED;">
                            <p style="font-size: 14px;color: #4c4948;float: left;margin: 0!important;">领取明细</p>
                        </div>
                    </div>
                    <div class="modal-body">
                        <div style="margin-bottom: 15px">
                            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">领取时间：</div>
                            <div style="float: left;width:350px;margin-right: 10px;" id="sandbox-container_coupon">

                                <div class="input-group date" style="width:46%;float:left;">
                                    <input type="text" class="form-control" id="start"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                                </div>
                                <div style="width: 4%;float:left;margin-left:7px;margin-top:8px;padding-left:1px;">
                                    -
                                </div>
                                <div class="input-group date" style="width:48%;">
                                    <input type="text" class="form-control" id="end"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                                </div>

                            </div>
                            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">状态：</div>
                            <div style="float: left;width:160px;margin-right: 10px;">
                                <select class="form-control" v-model="qc.statu" @keyup.enter="queryDetail">
                                    <option></option>
                                    <option value="0">未使用</option>
                                    <option value="1">已使用</option>
                                    <option value="2">已过期</option>
                                </select>
                            </div>
                            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">微信昵称：</div>
                            <div style="float: left;width:160px;margin-right: 10px;">
                                <input type="text" class="form-control" v-model="qc.wxname" @keyup.enter="queryDetail" placeholder="请输入微信昵称">
                            </div>
                            <div style="float: left;margin-left:10px;height:34px;line-height:34px;">订单号：</div>
                            <div style="float: left;width:160px;margin-right: 10px;">
                                <input type="text" class="form-control" v-model="qc.ordernum" @keyup.enter="queryDetail" placeholder="请输入订单号">
                            </div>
                            <a class="btn btn-primary" @click="queryDetail">搜索</a>
                        </div>
                        <table id="jqGridAddCoupon"></table>
                        <a class="btn btn-primary" @click="$('#myCouponDetailModal').modal('hide');" style="margin-left: 600px;margin-top: 10px">确定</a>
                    </div>
                </div>
            </form>
        </div>
    </div>


</div>

<script src="${request.contextPath}/statics/js/modules/sys/coupon.js?_${.now?long}"></script>
<script>
    $("#sandbox-container .input-group.date").datepicker({
        language: "zh-CN",
        clearBtn: true, //清除按钮
        format: "yyyy-mm-dd",
        todayHighlight:true
    });

    $("#sandbox-container_coupon .input-group.date").datepicker({
        language: "zh-CN",
        clearBtn: true, //清除按钮
        format: "yyyy-mm-dd",
        todayHighlight:true
    });

</script>
</body>
</html>